﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>信息修改</title>
</head>
<link rel="stylesheet" href="/static/layui/css/layui.css" />
<body>
<form class="layui-form"  action="" lay-filter="edit">
    <input type="hidden" name="id">
    <div class="layui-inline">
        <label class="layui-form-label">编号：</label>
        <div class="layui-input-inline">
            <input type="text" name="typeNo" id="typeNo" lay-verify="required" placeholder="请输入编号" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-inline">
        <label class="layui-form-label">权重：</label>
        <div class="layui-input-inline">
            <input type="text" name="hierarchy" id="hierarchy" lay-verify="required" placeholder="请输入权重" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">姓名：</label>
        <div class="layui-input-inline">
            <input type="text" name="name" id="name" lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">备注：</label>
        <div class="layui-input-inline">
            <input type="text" name="remark" id="remark" lay-verify="required" placeholder="请输入备注" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--    <div class="layui-inline">-->
    <!--        <label class="layui-form-label">创建时间：</label>-->
    <!--        <div class="layui-input-inline">-->
    <!--            <input type="text" name="create_datetime" id="create_datetime" lay-verify="required" placeholder="创建时间" autocomplete="off" class="layui-input">-->
    <!--        </div>-->
    <!--    </div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline layui-col-md4">
            <select name="flog" lay-filter="aihao">
                <option value="">--请选择--</option>
                <option value="1">否</option>
                <option value="2">是</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
</body>
<script src="/static/js/system.js"></script>
<script src="/static/js/jquery-3.3.1.js"></script>
<script src="/static/layui/layui.js"></script>
<script>
    //Demo
    layui.use(['form','layer'], function(){
        var form = layui.form;
            // laydate = layui.laydate;
        // laydate.render({
        //     elem: '#time'
        // });
        $.ajax({
            url:'/dite/findId',
            type:"post",
            dataType:"json",
            data:{"id":getQueryString("id")},
            success:function (da) {
                console.log(da)
                if (da.code == 200) {
                    form.val("edit", da.date);
                    // form.val("edit", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                    //     "time": layui.util.toDateString(da.date.time, 'yyyy-MM-dd')
                    // });
                } else {
                    parent.layer.msg("详情查询失败！");
                }
            }
        });
        //监听提交 15039939677
        form.on('submit(formDemo)', function(data){
            var data1 = form.val("edit");
            $.ajax({
                url:'/dite/update',
                type:"post",
                dataType:"json",
                data:data1,
                success:function (da) {
                    console.log(da)
                    if (da.code == 200) {
                        layer.alert("修改成功！", function () {
                            // window.parent.location.reload();//刷新父页面
                            // parent.layer.close(layer.index);//关闭弹出层
                            // location.reload("/view/dite/list.html")
                            parent.layer.closeAll();
                        });
                    } else {
                        layer.msg("修改失败！");
                    }
                }
            });
            return false;
        });
    });
</script>
</html>